package com.hy.search.pojo;

public class SearchRequest {

    private String key;//搜索条件
    private Integer page;//当前页
    private static final int DEFAULT_SIZE=5;//固定每页的大小
    private static final int DEFAULT_PAGE=1;//默认页

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Integer getPage() {
        if (page==null){

          return DEFAULT_PAGE;
        }
        return Math.max(DEFAULT_PAGE,page);//或取页时做校验，不能小于1，如负数就走默认值
    }

    public void setPage(Integer page) {

        this.page = page;
    }

    public static int getSize() {
        return DEFAULT_SIZE;
    }

    public static int getDefaultPage() {
        return DEFAULT_PAGE;
    }
}
